function test() {
  function show(verdict, color) {
    var to = document.getElementById("to");
    to.style.border = "1px solid "+ color;
    to.innerHTML = verdict;
  }
  function implode(list) {
    var tail = "";
    if (list.length > 1)
      tail = " and "+ list.pop();
    return list.join(", ") + tail;
  }
  function gotCounts(json) {
    var bad = [];
    for (var type in json) {
      var count = json[type];
      if (count) {
        bad.push(count +" "+ type +" version"+ (count==1?"":"s"))
      }
    }
    if (!bad.length)
      show("Google suggests that could be a decent password these days.",
           "green");
    else
      show("Google has seen "+ implode(bad) +" of that password. " +
           "Try another one.", "red");
  }
  var pwd = document.getElementById("pwd").value;
  var leak = document.getElementById("leak").checked;
  testPasswordGoogleSafety(pwd, gotCounts, leak);
}
